import React, { useEffect, useState } from 'react';
import huiyuan from "./img/ceo.png"
import "./index.scss"
import axios from 'axios'

const Ceo = () => {

    const [ceoList, setCeoList] = useState([])
    const [ceoList1, setCeoList1] = useState([])
    useEffect(() => {
        axios.post(
            "https://srv.hotkidceo.com/appapi/api/root-ceo-content/ceoPage/pageList",
            { "channelId": null, "memberKey": "", "roleKey": "", "type": 1 }
        ).then(res => {
            console.log(res);
            setCeoList(res.data.data[1].configureAttribute[0].list)
            setCeoList1(res.data.data[1].configureAttribute[1].list)
        })
    }, [])
    return (
        <div className='ceo_con'>
            <div className='ceo_img'><img src={huiyuan} alt={huiyuan} /></div>
            <div className='commodity'>
                <div className='ceo_title'>免费零食</div>
                <div className='ceo_sub'>每日领1款，天天0元享</div>
                <div className='container'>
                    <ul className='container-con container-con1'>
                        {
                            ceoList.map((item, index) => <li key={index} className="con-t">
                                <img src={item.listImages} alt={item.name} />
                                <div className='goods-name'>{item.name}</div>
                                <div className='title_01'>{item.displayName}</div>
                                <div className='title_02'>￥{item.retailPrice}</div>
                                <div className='goods-but'>{item.buyCartNum}元领</div>
                            </li>)

                        }

                    </ul>

                </div>
                <div className='ceo_sub'>限量供应，购物满99可享</div>
                <div className='container'>
                    <ul className='container-con'>
                        {
                            ceoList1.map((item, index) => <li key={index} className="con-t">
                                <img src={item.listImages} alt={item.name} />
                                <div className='goods-name'>{item.name}</div>
                                <div className='title_01'>{item.displayName}</div>
                                <div className='title_02'>￥{item.retailPrice}</div>
                                <div className='goods-but'>{item.buyCartNum}元领</div>
                            </li>)

                        }

                    </ul>

                </div>

            </div>
        </div>
    )
}
// }
export default Ceo